﻿@model IEnumerable<Ecommerce.Areas.Manager.Models.Customer>
@{
    ViewBag.Title = "View Customer";
}

<fieldset>
    <legend>Customer List</legend>
    <p class="field-validation-error">
        @ViewBag.ErrorMsg
    </p>
    <table border="0">
        <thead>
            <tr>
                <td>Full Name</td>
                <td>Email</td>
                <td>Orders</td>
                <td>Action</td>
            </tr>
        </thead>
        <tbody>
            @foreach (var item in Model)
            {
                <tr>
                    <td>@item.FullName</td>
                    <td>@item.Email</td>
                    @if (item.OrderList.Count == 0)
                    {
                        <td>Not yet</td>
                    }
                    else
                    {
                        <td>@item.OrderList.Count</td>
                    }
                    <td>
                        @Html.ActionLink("Delete", "Delete", new { cusID = item.CustomerID })&nbsp;
                        @Html.ActionLink("View Orders", "Index", "Order", new { cusID = item.CustomerID }, null)
                    </td>
                </tr>
            }
        </tbody>
    </table>
</fieldset>
